import HttpRequest from "@/utils/request";
import { IRows, IRole } from "./type";

// 查询列表
export function getRoles(params = {}) {
  return HttpRequest<IRows>("/role", "GET", params, {
    isLoading: true,
  });
}

// 获取所有
export function getAllRoles(params = {}) {
  return HttpRequest<IRows>("/role/findAll", "GET", params, {
    isLoading: true,
  });
}

// 查询某个
export function getRole(id: number) {
  return HttpRequest<IRole>("/role/" + id, "GET");
}

// 新增
export function addRole(params = {}) {
  return HttpRequest("/role", "POST", params);
}

// 修改
export function updateRole(params: any) {
  return HttpRequest("/role", "PUT", params);
}

// 删除
export function delRole(ids: number[] = []) {
  return HttpRequest("/role", "DELETE", { ids: ids.join() });
}
